package com.ruoyi.materialCuttingPlan.service.impl;

import java.util.List;

import com.ruoyi.common.annotation.DataScope;
import com.ruoyi.common.utils.DateUtils;
import com.ruoyi.common.utils.SecurityUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.materialCuttingPlan.mapper.McpProjectsMapper;
import com.ruoyi.materialCuttingPlan.domain.McpProjects;
import com.ruoyi.materialCuttingPlan.service.IMcpProjectsService;

/**
 * 工程项目信息Service业务层处理
 * 
 * @author ruoyi
 * @date 2025-07-04
 */
@Service
public class McpProjectsServiceImpl implements IMcpProjectsService 
{
    @Autowired
    private McpProjectsMapper mcpProjectsMapper;

    /**
     * 查询工程项目信息
     * 
     * @param id 工程项目信息主键
     * @return 工程项目信息
     */
    @Override
    public McpProjects selectMcpProjectsById(Long id)
    {
        return mcpProjectsMapper.selectMcpProjectsById(id);
    }

    /**
     * 查询工程项目信息列表
     * 
     * @param mcpProjects 工程项目信息
     * @return 工程项目信息
     */
    @Override
    @DataScope(userAlias = "u")
    public List<McpProjects> selectMcpProjectsList(McpProjects mcpProjects)
    {
        return mcpProjectsMapper.selectMcpProjectsList(mcpProjects);
    }

    /**
     * 新增工程项目信息
     * 
     * @param mcpProjects 工程项目信息
     * @return 结果
     */
    @Override
    public int insertMcpProjects(McpProjects mcpProjects)
    {
        mcpProjects.setCreateTime(DateUtils.getNowDate());
        mcpProjects.setCreateBy(SecurityUtils.getUsername());
        mcpProjects.setCreateById(SecurityUtils.getUserId());
        return mcpProjectsMapper.insertMcpProjects(mcpProjects);
    }

    /**
     * 修改工程项目信息
     * 
     * @param mcpProjects 工程项目信息
     * @return 结果
     */
    @Override
    public int updateMcpProjects(McpProjects mcpProjects)
    {
        mcpProjects.setUpdateTime(DateUtils.getNowDate());
        mcpProjects.setUpdateBy(SecurityUtils.getUsername());
        mcpProjects.setUpdateById(SecurityUtils.getUserId());
        return mcpProjectsMapper.updateMcpProjects(mcpProjects);
    }

    /**
     * 批量删除工程项目信息
     * 
     * @param ids 需要删除的工程项目信息主键
     * @return 结果
     */
    @Override
    public int deleteMcpProjectsByIds(Long[] ids)
    {
        return mcpProjectsMapper.deleteMcpProjectsByIds(ids);
    }

    /**
     * 删除工程项目信息信息
     * 
     * @param id 工程项目信息主键
     * @return 结果
     */
    @Override
    public int deleteMcpProjectsById(Long id)
    {
        return mcpProjectsMapper.deleteMcpProjectsById(id);
    }
}
